1. Technical Field
The present disclosure relates to an image forming apparatus that performs rectangle drawing processing. In particular, the present disclosure relates to an image forming apparatus that performs drawing processing based on an instruction included in a page description language.
2. Description of the Related Art
A typical image forming apparatus such as a printer interprets printable data received from a host computer, generates a bitmap image formed of dots, and performs printing thereof.
In one example, if the printable data includes a rectangle drawing instruction, a bitmap image formed of dots is generated by replacing a contour of a rectangle placed in a user coordinate space and a fill of an inside portion of the rectangle with dots in a device coordinate space.
In some examples, a PCL XL, which is known as a page description language that forms the printable data is interpreted by an image forming apparatus. A printer driver corresponding to the PCL XL issues a Rectangle operator or a PaintPath operator when generating the printable data including the rectangle drawing instruction.
An interpreter corresponding to the PCL XL (hereinafter referred to as “PCL XL interpreter”) executes “stroke” and “fill” operations for a current path regarding both thereof (the Rectangle operator and the PaintPath operator perform substantially the same processing because the Rectangle operator internally executes the PaintPath operator).
During the “stroke” operation, the contour is drawn on a path in accordance with the designation of PenSource (color of pen) and PenWidth (width of pen), while during the “fill” operation, the inside of the path is filled in accordance with the designation of BrushSource (color of brush).
In the PCL XL, the stroke and the fill operations are different in regard to their pixel placement (hereinafter referred to as “dot placement rule”).
When the rectangle subjected to a drawing instruction in the PCL XL is converted into the bitmap image, the contour is drawn in accordance with the dot placement rule called “Grid Intersection” for the stroke operation, while the inside portion of the rectangle is filled in accordance with the dot placement rule called “Grid Centered” for the fill operation.
When operating using the “Grid Intersection” rule, corresponding dots are placed based on a relationship between a drawing range of the fill and grid points. In part (a) of FIG. 9, the drawing range is the rectangle having reference points of (1.8, 1.4) and (5.2, 3.7), and during the fill operation, a region within this rectangle is filled. For example, (2, 2) is a grid point included in the drawing range, and hence a dot is placed in (2, 2). Further, a grid square expressed by (1, 1)-(2, 2) includes the drawing range in an inside portion thereof, and hence a dot is placed in (1, 1) as an upper-left grid point of this grid square (see part (b) of FIG. 9).
When operating using the “Grid Centered” rule, corresponding dots are placed based on a relationship between a center point of the grid square and the drawing range of the fill. For example, in part (a) of FIG. 9, (2.5, 1.5) is included in a rectangular region and is also the center point of the grid square, and hence a dot is placed in (2, 1) (see part (c) of FIG. 9). Such a dot placement rule is applied to the drawing of a bar code using a Windows® application such as BarStar® as illustrated in FIG. 10.
In practice, the bar code generated by such an application is pasted on data within a business application, such as word-processing software (e.g. Wore) or spreadsheet software (e.g. Excel®), to thereby convert the bar code into a vector image before printing thereof.
The conversion into the vector image provides an advantage in that an image is less likely to deteriorate even if the image is enlarged or reduced by the application.
Depending on the kind of business application or setting conditions, the bar code varies from one that is pasted as a vector image having a standard metafile format, such as a Windows® metafile format, to one that is pasted as a vector image having an enhanced metafile format in the case of the spreadsheet software.
Then, when printing such a bar code, the business application instructs the printer driver about the drawing of the contour and the filling of the inside portion as separate drawing commands.
However, when the printer driver generates the printable data in a PCL XL format based on the above-mentioned instructions, the drawing instructions differ depending on a difference in image format of the pasted bar code.
Specifically, if the bar code pasted in the data of the business application is the enhanced metafile format, only the PaintPath operator is issued in order to draw the contour and to fill the inside portion. On the other hand, if the bar code pasted in the data of the business application has the standard metafile format, the Rectangle operator is issued in order to draw the contour, and the PaintPath operator is issued in order to fill the inside portion.
Accordingly, no problem occurs in the case of printing the bar code formed in the enhanced metafile format. However, in the case of printing the bar code formed in the standard metafile format, the intermediation of two operators is involved, which may inhibit the bar code from being correctly drawn under a predetermined condition.
Specifically, when the placement of dots relating to the conversion from the user coordinate space into the device coordinate space involves rotation of the user coordinate space, a dot image corresponding to the contour and a dot image corresponding to the fill of the inside portion may become inconsistent thereby creating a line-shaped blank having a predetermined width in the inside portion of the bar code.
For example, in a case where the user coordinate space defined as landscape is printed on portrait-oriented paper or other such case, the line-shaped blank may occur when the user coordinate space is rotated counterclockwise by 90 degrees.
FIG. 11 illustrates an example of the printable data relating to the drawing of the bar code. Specifically, FIG. 11 illustrates the printable data on a bar (standard metafile format) of the bar code pasted in the word-processing software.
FIG. 12 illustrates a drawing processing procedure for forming the dot image of the bar in the device coordinate space based on the printable data illustrated in FIG. 11. In this example, the drawing processing procedure does not involve the rotation of the user coordinate space.
The device coordinate space is assumed to have a rightward direction indicating a positive x-axis direction and a downward direction indicating a positive y-axis direction.
Both in the user coordinate space and the device coordinate space, the rightward direction indicates the positive x-axis direction and the downward direction indicates the positive y-axis direction in a case where the rotation is not performed.
When receiving the printable data described in the PCL XL illustrated in FIG. 11, the PCL XL interpreter interprets the printable data, and controls processing of parts (i) to (iv) of FIG. 12.
First, when “x2 y2 x2′ y2′ BoundingBox” is interpreted, the Rectangle operator sets a path of the rectangle having reference points of (x2, y2) and (x2′, y2′) in the user coordinate space (part (i) of FIG. 12).
Subsequently, drawing processing of filling this rectangular region with black is performed based on “0 BrushSource” (part (ii) of FIG. 12). Note that, “NullPen PenSource” inhibits the stroke from being performed.
The Grid Centered rule is applied to this drawing processing, with the result that, as illustrated in part (ii) of FIG. 12, corresponding dots “F” are placed in the device coordinate space.
Subsequently, when “x1 y1 x1′ y1′ LinePath” is interpreted, the PaintPath operator sets the path of the rectangular region having reference points of (x1,y1) and (x1′,y1′) in the user coordinate space (part (iii) of FIG. 12).
Then, processing of drawing the contour on the set path is performed based on “0 PenSource” (part (iv) of FIG. 12). Note that, “NullBrush BrushSource” inhibits the fill from being performed.
The Grid Intersection rule is applied to this drawing processing, with the result that, as illustrated in part (iv) of FIG. 12, corresponding dots “S” are placed in the device coordinate space.
In this manner, even when the rectangle forms the standard metafile format, thereby involving the intermediation of the two operators, if the rotation is not involved, the user coordinate space and the device coordinate space become consistent with the corresponding dots placed appropriately, and hence the rectangle can be drawn correctly.
FIG. 13 illustrates the drawing processing procedure for placing and forming the dot image of the rectangle in the device coordinate space based on the printable data illustrated in FIG. 11. In this drawing processing procedure, the user coordinate space is rotated counterclockwise by 90 degrees.
In this case, the Rectangle operator sets the path of the rectangle having reference points of (x2, y2) and (x2′, y2′) in the user coordinate space (part (i) of FIG. 13).
Subsequently, the drawing processing of filling this rectangular region with black is performed based on “0 BrushSource” (part (ii) of FIG. 13). The Grid Centered rule is applied to this drawing processing, and hence, as illustrated in part (ii) of FIG. 13, the dots “F” corresponding to the positions of (x,y)=(3,3), (4,3),(5,3),(6,3),(3,4),(4,4),(5,4), and (6,4) are placed in the device coordinate space.
Subsequently, the PaintPath operator sets the path of the rectangle having reference points of (x1,y1) and (x1′,y1′) in the user coordinate space (part (iii) of FIG. 13).
Subsequently, the processing of drawing the contour on the set path is performed based on “0 PenSource” (part (iv) of FIG. 13). The Grid Intersection rule is applied to this drawing processing, and hence, as illustrated in part (iv) of FIG. 13, the dots “S” corresponding to (x,y)=(3,3), (4,3), (5,3), (6,3), (7,3), (8,3), (3,4), (8,4), (3,5), (8,5), (3,6), (4,6), (5,6), (6,6), (7,6), and (8,6) are placed in the device coordinate space.
In other words, as a result, dots are not placed in (x,y)=(4,5), (5,5), (6,5), and (7,5) corresponding to the inside portion of the rectangle, which causes a one-dot-line blank.
Specifically, such a one-dot-line blank occurs when all the following conditions are satisfied: a drawing such that one rectangular image is formed of the stroke of the contour and the fill of the inside portion thereof; the width (PenWidth) of the contour of the rectangle is set to zero; and the image having the standard metafile format is used as the printable data.
FIG. 14 illustrates the line-shaped blank occurring when the thus-created bar code is printed.
As illustrated in FIG. 14, when the bar code has the standard metafile format described in the PCL XL and is printed with an orientation thereof changed due to the rotation of the user coordinate space, the line-shaped blank having a one-dot width occurs.
Therefore, when such a bar code is read, false recognition of data, an error in reading, or the like may occur.